<%--
  Created by IntelliJ IDEA.
  User: jqy
  Date: 2023/12/9
  Time: 17:21
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.sql.*" %>
<%@ page import="cn.sqlexperiment.web.classes.PrescripData" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %>
<%@ page import="cn.sqlexperiment.web.servlet.Page" %>

<html>
<head>
    <title>student</title>
    <style>
        .box {
            width: 1000px;
            height: 600px;
            flex-shrink: 0;
            /* 超出部分隐藏 */
            overflow: hidden;
            margin: auto;
            display: flex;
            background-color: #E1E9EF;
        }

        /*.content {
            width: 1000px;
            height: 600px;
            flex-shrink: 0;
        }*/

        .table11_3 {
            width: 1000px;
            height: 600px;
        }

        .table11_3 table {
            margin: 40px 20px;
            border: 0;
        }

        .table11_3 th {
            background-color: #FF5675;
            color: #FFFFFF
        }

        .table11_3, .table11_3 th, .table11_3 td {
            font-size: 0.95em;
            text-align: center;
            padding: 4px;
            border-collapse: collapse;
        }

        .table11_3 th, .table11_3 td {
            border: 1px solid #fe2047;
            border-width: 1px 0 1px 0;
            border: 2px inset #ffffff;
        }

        .table11_3 tr {
            border: 1px solid #ffffff;
        }

        .table11_3 tr:nth-child(odd) {
            background-color: #fec6d1;
        }

        .table11_3 tr:nth-child(even) {
            background-color: #ffffff;
        }
    </style>
</head>
<body>
<%
    List<PrescripData> productList = new ArrayList<>();
    productList = (List) request.getAttribute("products");
    Page pages = (Page) request.getAttribute("page");
%>
<div class="box">
    <table border="1" class=table11_3>
        <tr>
            <td>医生姓名</td>
            <td>患者姓名</td>
            <td>患者身份证号</td>
            <td>用药情况</td>
            <td>开出时间</td>
        </tr>
        <%
            if (productList != null) {
                for (PrescripData product : productList) {
                    if (product.getPrescrno() != null) {
        %>
        <tr>
            <td><%=product.getPrescrno()%>
            </td>
            <td><%=product.getPrescrpatino()%>
            </td>
            <td><%=product.getPresrcdocno()%>
            </td>
            <td><%=product.getPrescrmedi()%>
            </td>
            <td><%=product.getPrescrdate()%>
            </td>
        </tr>
        <%
        } else {
        %>
        <tr>
            <td colspan="6">该病人<%=product.getPrescrcaseno()%>号病历下无处方记录
            </td>
        </tr>
        <%
                    }
                }
            }
        %>
        <tr>
            <td colspan="6">
                <a href="/_war_exploded/ShowPrescripServlet?pageIndex=1&patino=<%=productList.get(0).getPresrcdocno()%>&caseno=<%=productList.get(0).getPrescrcaseno()%>">首页</a>&nbsp;
                <%
                    if (pages.getPageIndex() > 1) {
                %>
                <a href="/_war_exploded/ShowPrescripServlet?pageIndex=${page.pageIndex - 1}&patino=<%=productList.get(0).getPresrcdocno()%>&caseno=<%=productList.get(0).getPrescrcaseno()%>">上一页</a>&nbsp;
                <%
                    }
                    if (pages.getPageIndex() < pages.getTotalPages()) {
                %>
                <a href="/_war_exploded/ShowPrescripServlet?pageIndex=${page.pageIndex + 1}&patino=<%=productList.get(0).getPresrcdocno()%>&caseno=<%=productList.get(0).getPrescrcaseno()%>">下一页</a>&nbsp;
                <%
                    }
                %>
                <a href="/_war_exploded/ShowPrescripServlet?pageIndex=${page.totalPages}&patino=<%=productList.get(0).getPresrcdocno()%>&caseno=<%=productList.get(0).getPrescrcaseno()%>">尾页</a>&nbsp;
                <a href="updataprescrip.jsp?patino=<%=productList.get(0).getPresrcdocno()%>&prescrcaseno=<%=productList.get(0).getPrescrcaseno()%>">开新处方</a>&nbsp;
            </td>
        </tr>
    </table>
</div>
</body>
</html>

